<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 <meta>
  <!-- Stylesheets -->
  <link href="../web.css" type="text/css" rel="stylesheet"></link>
  <link href="../pygmentize.css" type="text/css" rel="stylesheet"></link>
  <title>VLFeat - Documentation - C API</title>
  <link rel="stylesheet" type="text/css" href="../doxygen.css"></style>

  <!-- Scripts-->
  
 </meta>

 <!-- Body Start -->
 <body>
  <div id="header">
   <!-- Google CSE Search Box Begins -->
   <form action="http://www.vlfeat.org/search.html" method="get" id="cse-search-box" enctype="application/x-www-form-urlencoded">
    <div>
     <input type="hidden" name="cx" value="003215582122030917471:oq23albfeam"></input>
     <input type="hidden" name="cof" value="FORID:11"></input>
     <input type="hidden" name="ie" value="UTF-8"></input>
     <input type="text" name="q" size="31"></input>
     <input type="submit" name="sa" value="Search"></input>
    </div>
   </form>
   <script src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en" xml:space="preserve" type="text/javascript"></script>
   <!-- Google CSE Search Box Ends -->
   <h1><a shape="rect" href="../index.html" class="plain"><span id="vlfeat">VLFeat</span><span id="dotorg">.org</span></a></h1>
  </div>
  <div id="headbanner">
   Documentation - C API
  </div>
  <div id="pagebody">
   <div id="sidebar"> <!-- Navigation Start -->
    <ul>
<li><a href="../index.html">Home</a>
</li>
<li><a href="../download.html">Download</a>
</li>
<li><a href="../doc.html">Documentation</a>
<ul>
<li><a href="../mdoc/mdoc.html">Matlab API</a>
</li>
<li><a href="index.html" class='active' >C API</a>
</li>
<li><a href="../man/man.html">Man pages</a>
</li>
</ul></li>
<li><a href="../overview/tut.html">Tutorials</a>
</li>
<li><a href="../applications/apps.html">Applications</a>
</li>
</ul>

   </div> <!-- sidebar -->
   <div id="content">
    
    <link rel="stylesheet" type="text/css" href="../doxygen.css"></style>
    <div class="doxygen">
<div>
<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">pegasos.h File Reference</div>  </div>
</div>
<div class="contents">

<p>PEGASOS (<a class="el" href="pegasos.html">PEGASOS SVM solver</a>)  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="generic_8h.html">generic.h</a>&quot;</code><br/>
</div><table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pegasos_8h.html#a13544d1f72e8f428e9dbf0d20241b693">vl_pegasos_train_binary_svm_d</a> (double *model, double const *data, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> dimension, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numSamples, <a class="el" href="host_8h.html#aee4cc9690b799a33dfc9614636ac34a1">vl_int8</a> const *labels, double regularizer, double biasMultiplier, <a class="el" href="host_8h.html#ac13bd3cc913e1da576e189a3ec8d66fc">vl_uindex</a> startingIteration, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numIterations, <a class="el" href="structVlRand.html">VlRand</a> *randomGenerator, <a class="el" href="host_8h.html#aeb7c862765448a70017105efa4d25e7a">vl_uint32</a> const *permutation, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> permutationSize, double const *preconditioner)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="pegasos_8h.html#a1c3c702bb19206c992fc166d82709c6b">vl_pegasos_train_binary_svm_f</a> (float *model, float const *data, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> dimension, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numSamples, <a class="el" href="host_8h.html#aee4cc9690b799a33dfc9614636ac34a1">vl_int8</a> const *labels, double regularizer, double biasMultiplier, <a class="el" href="host_8h.html#ac13bd3cc913e1da576e189a3ec8d66fc">vl_uindex</a> startingIteration, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> numIterations, <a class="el" href="structVlRand.html">VlRand</a> *randomGenerator, <a class="el" href="host_8h.html#aeb7c862765448a70017105efa4d25e7a">vl_uint32</a> const *permutation, <a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a> permutationSize, float const *preconditioner)</td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><dl class="author"><dt><b>Author:</b></dt><dd>Andrea Vedaldi </dd></dl>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="a13544d1f72e8f428e9dbf0d20241b693"></a><!-- doxytag: member="pegasos.h::vl_pegasos_train_binary_svm_d" ref="a13544d1f72e8f428e9dbf0d20241b693" args="(double *model, double const *data, vl_size dimension, vl_size numSamples, vl_int8 const *labels, double regularizer, double biasMultiplier, vl_uindex startingIteration, vl_size numIterations, VlRand *randomGenerator, vl_uint32 const *permutation, vl_size permutationSize, double const *preconditioner)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vl_pegasos_train_binary_svm_d </td>
          <td>(</td>
          <td class="paramtype">double *&#160;</td>
          <td class="paramname"><em>model</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double const *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>dimension</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numSamples</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#aee4cc9690b799a33dfc9614636ac34a1">vl_int8</a> const *&#160;</td>
          <td class="paramname"><em>labels</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>regularizer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>biasMultiplier</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#ac13bd3cc913e1da576e189a3ec8d66fc">vl_uindex</a>&#160;</td>
          <td class="paramname"><em>startingIteration</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numIterations</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structVlRand.html">VlRand</a> *&#160;</td>
          <td class="paramname"><em>randomGenerator</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#aeb7c862765448a70017105efa4d25e7a">vl_uint32</a> const *&#160;</td>
          <td class="paramname"><em>permutation</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>permutationSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double const *&#160;</td>
          <td class="paramname"><em>preconditioner</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">model</td><td>(out) the learned model. </td></tr>
    <tr><td class="paramname">data</td><td>training vectors. </td></tr>
    <tr><td class="paramname">dimension</td><td>data dimension. </td></tr>
    <tr><td class="paramname">numSamples</td><td>number of training data vectors. </td></tr>
    <tr><td class="paramname">labels</td><td>labels of the training vectors. </td></tr>
    <tr><td class="paramname">regularizer</td><td>value of the regularizer coefficient <img class="formulaInl" alt="$ \lambda $" src="form_286.png"/>. </td></tr>
    <tr><td class="paramname">biasMultiplier</td><td>value of the bias multiplier <img class="formulaInl" alt="$ B $" src="form_273.png"/>. </td></tr>
    <tr><td class="paramname">startingIteration</td><td>number of the first iteration. </td></tr>
    <tr><td class="paramname">numIterations</td><td>number of iterations to perform. </td></tr>
    <tr><td class="paramname">randomGenerator</td><td>random number generator. </td></tr>
    <tr><td class="paramname">permutation</td><td>order in which the data is accessed. </td></tr>
    <tr><td class="paramname">permutationSize</td><td>length of <code>permutation</code>. </td></tr>
    <tr><td class="paramname">preconditioner</td><td>diagonal precoditioner.</td></tr>
  </table>
  </dd>
</dl>
<p>The function runs PEGASOS on the specified data. The vector <em>model</em> must have either dimension equal to <em>dimension</em> if <em>biasMultiplier</em> is zero, or <em>dimension</em> + 1 if <em>biasMultiplier</em> is larger than zero.</p>
<p>The function runs PEGASOS for iterations <em>t</em> in the interval [<em>fistIteration</em>, <em>lastIteration</em>]. Together with the fact that the initial model can be set arbitrarily, this enable restarting PEGASOS from any point.</p>
<p>PEGASOS select the next point for computing the gradient at random. If <em>randomGenerator</em> is <code>NULL</code>, the default random generator (as returned by <a class="el" href="generic_8c.html#ac0ce7fb575acd4f01cbb4a275ba84700" title="Get the random number generator for this thread.">vl_get_rand()</a>) is used.</p>
<p>Alternatively, if <em>permutation</em> is not <code>NULL</code>, then points are sampled in the order specified by this vector of indexes (this is cycled through). In this way It is an error to set both <em>randomGenerator</em> and <em>permutation</em> to non-null values.</p>
<p><code>preconditioner</code> specifies a diagonal preconditioner for the minimization problem (it is often useful to slow down the steps for the bias term, if the latter is used). Set <code>preconditioner</code> to NULL to avoid using a preconditioner. The precodnitioner should have the same dimension of the model, plus one if an SVM with bias is learned.</p>
<p>See the <a class="el" href="pegasos.html#pegasos-overview">Overview</a> overview for details. </p>

</div>
</div>
<a class="anchor" id="a1c3c702bb19206c992fc166d82709c6b"></a><!-- doxytag: member="pegasos.h::vl_pegasos_train_binary_svm_f" ref="a1c3c702bb19206c992fc166d82709c6b" args="(float *model, float const *data, vl_size dimension, vl_size numSamples, vl_int8 const *labels, double regularizer, double biasMultiplier, vl_uindex startingIteration, vl_size numIterations, VlRand *randomGenerator, vl_uint32 const *permutation, vl_size permutationSize, float const *preconditioner)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vl_pegasos_train_binary_svm_f </td>
          <td>(</td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>model</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float const *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>dimension</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numSamples</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#aee4cc9690b799a33dfc9614636ac34a1">vl_int8</a> const *&#160;</td>
          <td class="paramname"><em>labels</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>regularizer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>biasMultiplier</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#ac13bd3cc913e1da576e189a3ec8d66fc">vl_uindex</a>&#160;</td>
          <td class="paramname"><em>startingIteration</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>numIterations</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structVlRand.html">VlRand</a> *&#160;</td>
          <td class="paramname"><em>randomGenerator</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#aeb7c862765448a70017105efa4d25e7a">vl_uint32</a> const *&#160;</td>
          <td class="paramname"><em>permutation</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="host_8h.html#a0ee26101458c663510d620e3ee7e2555">vl_size</a>&#160;</td>
          <td class="paramname"><em>permutationSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float const *&#160;</td>
          <td class="paramname"><em>preconditioner</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="pegasos_8h.html#a13544d1f72e8f428e9dbf0d20241b693">vl_pegasos_train_binary_svm_d</a> </dd></dl>

</div>
</div>
</div>
     <!-- Doc Here -->
    </div>
   
   </div>
   <div class="clear">&nbsp;</div>
  </div> <!-- pagebody -->
  <div id="footer">
   &copy; 2007-12 Andrea Vedaldi and Brian Fulkerson
  </div> <!-- footer -->

  <!-- Google Analytics Begins -->
  <script xml:space="preserve" type="text/javascript">
   //<![CDATA[
    var localre = /vlfeat.org/;
    if(document.location.host.search(localre) != -1)
    {
   var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
   document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
   }
   //]]>
  </script>
  <script xml:space="preserve" type="text/javascript">
    //<![CDATA[
    var localre = /vlfeat.org/;
    if(document.location.host.search(localre) != -1)
    {

   try {
   var pageTracker = _gat._getTracker("UA-4936091-2");
   pageTracker._trackPageview();
   } catch(err) {}

   }
   //]]>
  </script>
  <!-- Google Analytics Ends -->
 </body>
</html>

 
